from django.shortcuts import render, redirect
from app01.utils.form import UserRegisterModelForm

# Create your views here.


def register(request):
    coo = request.session.get('info', "")
    if request.method == "GET":
        form = UserRegisterModelForm()
        return render(request, 'register/register.html', {"form": form, "coo": coo})
    form = UserRegisterModelForm(data=request.POST)
    if form.is_valid():
        form.save()
        return redirect('/login/')
    return render(request, 'register/register.html', {"form": form, "coo": coo})
